package pers.twf.twfRpc.loadbalancer;

import pers.twf.twfRpc.spi.SpiLoader;

/**
 * 负载均衡器工厂
 */
public class LoadBalancerFactory {

    static {
        SpiLoader.load(LoadBalancer.class);
    }

    /**
     * 默认负载均衡器——轮询
     */
    private static final LoadBalancer DEFAULT_LOAD_BALANCER = new RoundRobinLoadBalancer();

    /**
     * 根据负载均衡器名称获取负载均衡器
     * @param loadBalancerName
     */
    public static LoadBalancer getLoadBalancer(String loadBalancerName)
    {
        return SpiLoader.getInstance(LoadBalancer.class, loadBalancerName);
    }


}
